function WinOpen(file, w, h) {
  var option = "width=" + w + ",height=" + h;
  window.open(file,"",option + ",left=100,top=100,scrollbars=yes,menubar=no,toolbar=no,statusbar=no,resizable=yes,directories=no");
}

function CoaSearch() {
  var p = document.CoAForm.p.value.replace(/^[ 　]+|[ 　]+$/g, '');
  var l = document.CoAForm.l.value.replace(/^[ 　]+|[ 　]+$/g, '');

  if (p.length == 0 && l.length == 0) {
    alert("请填写产品编号和批号");
    return false;
  } else if (p.length == 0 && l.length != 0) {
    alert("请填写产品编码");
    return false;
  } else if (p.length != 0 && l.length == 0) {
    alert("请填写批号");
    return false;
  }

  document.CoAForm.submit();
  return true;
}

function MsdsSearch() {
  var p = document.MSDSForm.item.value.replace(/^[ 　]+|[ 　]+$/g, '');

  if (p.search(/^[A-Z]{1}[0-8]{1}[0-9]{3}$/i) == -1) {
    alert('产品编码输入错误');
    return false;
  }
  document.MSDSForm.submit();
  return true;
}
